
% load('training_input_rednoise_norm_b001')
% load('training_output_norm')
% net = getDenoisingNetwork;
output_small=zeros(26*49,10000);
% for i=1:10000
%    swp=reshape(output(:,i),54,98);
%    output_small(:,i)=reshape(imresize(swp, [26,49],'nearest'),26*49,1);
% end
% clear output
total_num=10000;
sizex=54;
sizey=98;
layers = net.Layers;
layers = [
    imageInputLayer([54 98])
    layers(2:57)
    fullyConnectedLayer(26*49)
    regressionLayer];


% options = trainingOptions('sgdm', ...
%     'MaxEpochs',100, ...
%     'InitialLearnRate',1e-3, ...
%     'LearnRateSchedule','piecewise', ...
%     'LearnRateDropFactor',0.1, ...
%     'LearnRateDropPeriod',75, ...
%     'Shuffle','every-epoch', ...
%     'Plots','training-progress', ...
%     'Verbose',true);
options = trainingOptions('sgdm',...
    'MiniBatchSize',32, ...
    'MaxEpochs',50, ...
    'InitialLearnRate',0.001, ...
    'Plots','training-progress',...
    'Verbose',false);
net = trainNetwork(input_3D,output_small',layers,options);